import { Column, Entity, Index } from "typeorm";

@Index("index_menu_hidden", ["hidden"], {})
@Index("index_menu_status", ["status"], {})
@Index("index_menu_type", ["menuType"], {})
@Entity("sys_permission", { schema: "workflow" })
export class SysPermission {
    @Column("char", { primary: true, name: "id", comment: "主键id", length: 36 })
    id: string;

    @Column("char", {
        name: "parent_id",
        nullable: true,
        comment: "父id",
        length: 36,
    })
    parentId: string | null;

    @Column("varchar", {
        name: "name",
        nullable: true,
        comment: "菜单标题",
        length: 255,
    })
    name: string | null;

    @Column("varchar", {
        name: "url",
        nullable: true,
        comment: "路径",
        length: 255,
    })
    url: string | null;

    @Column("varchar", {
        name: "component",
        nullable: true,
        comment: "组件",
        length: 255,
    })
    component: string | null;

    @Column("tinyint", {
        name: "is_route",
        nullable: true,
        comment: "是否路由菜单: 0:不是  1:是（默认值1）",
        width: 1,
        default: () => "'1'",
    })
    isRoute: boolean | null;

    @Column("varchar", {
        name: "component_name",
        nullable: true,
        comment: "组件名字",
        length: 255,
    })
    componentName: string | null;

    @Column("varchar", {
        name: "redirect",
        nullable: true,
        comment: "一级菜单跳转地址",
        length: 255,
    })
    redirect: string | null;

    @Column("int", {
        name: "menu_type",
        nullable: true,
        comment: "菜单类型(0:一级菜单; 1:子菜单:2:按钮权限)",
    })
    menuType: number | null;

    @Column("varchar", {
        name: "perms",
        nullable: true,
        comment: "菜单权限编码",
        length: 255,
    })
    perms: string | null;

    @Column("varchar", {
        name: "perms_type",
        nullable: true,
        comment: "权限策略1显示2禁用",
        length: 10,
        default: () => "'0'",
    })
    permsType: string | null;

    @Column("double", {
        name: "sort_no",
        nullable: true,
        comment: "菜单排序",
        precision: 8,
        scale: 2,
    })
    sortNo: number | null;

    @Column("tinyint", {
        name: "always_show",
        nullable: true,
        comment: "聚合子路由: 1是0否",
        width: 1,
    })
    alwaysShow: boolean | null;

    @Column("varchar", {
        name: "icon",
        nullable: true,
        comment: "菜单图标",
        length: 255,
    })
    icon: string | null;

    @Column("tinyint", {
        name: "iz_leaf",
        nullable: true,
        comment: "是否叶子节点:    1是0否",
        width: 1,
        default: () => "'1'",
    })
    izLeaf: boolean | null;

    @Column("tinyint", {
        name: "keep_alive",
        nullable: true,
        comment: "是否缓存该页面:    1:是   0:不是",
        width: 1,
        default: () => "'1'",
    })
    keepAlive: boolean | null;

    @Column("tinyint", {
        name: "hidden",
        nullable: true,
        comment: "是否隐藏路由: 0否,1是",
        width: 1,
        default: () => "'0'",
    })
    hidden: boolean | null;

    @Column("varchar", {
        name: "description",
        nullable: true,
        comment: "描述",
        length: 255,
    })
    description: string | null;

    @Column("varchar", {
        name: "create_by",
        nullable: true,
        comment: "创建人",
        length: 255,
    })
    createBy: string | null;

    @Column("datetime", {
        name: "create_time",
        nullable: true,
        comment: "创建时间",
    })
    createTime: Date | null;

    @Column("varchar", {
        name: "update_by",
        nullable: true,
        comment: "更新人",
        length: 255,
    })
    updateBy: string | null;

    @Column("datetime", {
        name: "update_time",
        nullable: true,
        comment: "更新时间",
    })
    updateTime: Date | null;

    @Column("tinyint", {
        name: "del_flag",
        nullable: true,
        comment: "删除状态 0正常 1已删除",
        width: 1,
        default: () => "'0'",
    })
    delFlag: boolean | null;

    @Column("int", {
        name: "rule_flag",
        nullable: true,
        comment: "是否添加数据权限1是0否",
        default: () => "'0'",
    })
    ruleFlag: number | null;

    @Column("tinyint", {
        name: "status",
        nullable: true,
        comment: "按钮权限状态(0无效1有效)",
        width: 1,
        default: () => "'0'",
    })
    status: boolean | null;
}
